<?php
namespace Home\Controller;
use Think\Controller;
//header("content-type:text/html;charset=utf-8");编码格式

class BaseController extends Controller{
    //使用tp框架提供的构造函数验证session中是否有用户的信息的唯一标识user_id
    public function _initialize(){
        $user_id = session('user_id');
        if(!$user_id){
            //获取当前网页，授权后跳回
            $path =  $_SERVER['REQUEST_URI'];
            
            //跳转到微信授权
            header('Location:/home/auth/index?path='.$path);
        }
    }
    

}